
import request from '@/utils/request'

const api = {
    querySettlementStatistics: '/v1/stats/settlement', // 结算单数据统计
    downloadSettlementStatistics: '/v1/stats/settlement/export', // 导出结算单统计数据
    querySettlementDetailStatistics: '/v1/stats/settlement/detail', // 结算明细统计
    queryAwardRecordGather: '/v1/award/record/gather', // 佣金统计信息和列表
    refuseReceiveAward: '/v1/award/receive/refuse', // 驳回当前推广佣金
    queryAccountListByAwardAlive: '/v1/award/alive/account/', // 获取当前佣金单可用支付账户
    payAwardOrder: '/v1/award/pay', // 佣金单支付
    downloadSettlementDetail: '/v1/stats/settlement/detail/export', // 导出结算明细数据
}

// 结算单数据统计
export function querySettlementStatistics (parameter) {
    return request({
        url: api.querySettlementStatistics,
        method: 'get',
        headers: {
            'name':'querySettlementStatistics',
        },
        params: parameter
    })
}
// 导出结算单统计数据
export function downloadSettlementStatistics (parameter) {
    return request({
        url: api.downloadSettlementStatistics,
        method: 'get',
        responseType: "arraybuffer",
        headers: {
            'name':'downloadSettlementStatistics',
        },
        params: parameter,
    })
}

// 结算明细统计
export function querySettlementDetailStatistics (parameter) {
    return request({
        url: api.querySettlementDetailStatistics,
        method: 'get',
        headers: {
            'name':'querySettlementDetailStatistics',
        },
        params: parameter
    })
}

// 佣金统计信息和列表
export function queryAwardRecordGather (parameter) {
    return request({
        url: api.queryAwardRecordGather,
        method: 'get',
        headers: {
            'name':'queryAwardRecordGather',
        },
        params: parameter
    })
}

// 驳回当前推广佣金
export function refuseReceiveAward (parameter){
    return request({
        url: api.refuseReceiveAward,
        method: 'post',
        headers: {
            'name': 'refuseReceiveAward',
        },
        data: parameter,
    })
}

// 获取当前佣金单可用支付账户
export function queryAccountListByAwardAlive(awardId){
    return request({
        url: api.queryAccountListByAwardAlive + awardId,
        method: 'get',
        headers: {
            'name': 'queryAccountListByAwardAlive',
        },
        params: {}
    })
}

// 佣金单支付
export function payAwardOrder (parameter){
    return request({
        url: api.payAwardOrder,
        method: 'post',
        headers: {
            'name': 'payAwardOrder',
        },
        data: parameter,
    })
}

// 导出结算明细数据
export function downloadSettlementDetail (parameter) {
    return request({
        url: api.downloadSettlementDetail,
        method: 'get',
        responseType: "arraybuffer",
        headers: {
            'name':'downloadSettlementDetail',
        },
        params: parameter
    })
}